<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="oneroom.admin.member.MemberModel" %>
<%@ page import="java.util.List" %>
<jsp:useBean id="member" class="oneroom.admin.member.MemberDao" scope="page"/>
<%
	String id = request.getParameter("id") == null ? "" : request.getParameter("id");
	String pw = request.getParameter("pw") == null ? "" : request.getParameter("pw");
	String loginOk = "false";
	if( !id.equals("") && !pw.equals("")){
		List list = member.loginOk(id , pw);
		if(list != null && list.size() >  0){
			loginOk = "true";
			MemberModel mod = (MemberModel)list.get(0);
			session.setAttribute("id",mod.getId());
			session.setAttribute("name",mod.getName());
			session.setAttribute("tel",mod.getTel());
			session.setAttribute("hp",mod.getHp());
			session.setAttribute("email",mod.getEmail());
			session.setAttribute("grade",mod.getGrade());
			session.setAttribute("authorize",mod.getAuthorize());
		}
	}
%>    
<script type="text/javascript">
<!--
<%
		if(loginOk.equals("true")){
%>
			location.href="/room/main.jsp";
			alert("로그인되었습니다.");
<%
		}else if(loginOk.equals("false")){
%>
			location.href="login.jsp";
			alert("아이디/비밀번호를 확인하세요");
<%
		}
%>
//-->
</script>